<?php

class Settings extends Controller {

	function Settings()
	{
		parent::Controller();
		
		//load the EzAuth model
		$this->load->model('EzAuth_Model', 'ezauth');

		//this is the store program (ezauth purposes)
		$this->ezauth->program = 'store';		
		
		//automatically login if user has cookie hash saved
		$this->ezauth->auto_login();		
		
		//this is the list of pages you need to be logged in to view
		$this->ezauth->protected_pages = array(
					'all'			=>    	'user'
					);
	}
	
	//todo: put this in a helper
	
	//do something before we load the page:
	//check to see if you are logged in
	function _remap($method) {
		$auth = $this->ezauth->authorize($method, true);
		if ($auth['authorize'] == 'yes') {
			$segments = array_slice($this->uri->segment_array(),2);	//redirect with method arguments by marlar on CodeIgniter forums
			call_user_func_array(array(&$this, $method), $segments);
		} else {
		    // user login information incorrect, so show login screen again
		    $this->login();
		}
	}

	
	function index()
	{
		
	}
}
?>